#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
    int carFleet(int target, vector<int>& position, vector<int>& speed) {
        if (position.size() < 1) return 0;
        vector<int>indexs(position.size());
        for (int i = 0; i < indexs.size(); ++i) indexs[i] = i;
        sort(indexs.begin(), indexs.end(), [&](const int& left, const int& right) {
            return position[left] < position[right] ||
                (position[left] == position[right] && speed[left] < speed[right]);
            });
        int cnt = 0;
        double cost = -1;
        for (int i = indexs.size() - 1; i >= 0; --i) {
            double tmp = (target - position[indexs[i]]) * 1.0 / speed[indexs[i]];
            if (cost == -1 || cost < tmp) {
                ++cnt;
                cost = tmp;
            }
        }
        return cnt;
    }
};

int main() {
    vector<int>position = { 6,8 };
    vector<int>speed = { 3,2 };
    Solution sol;
    sol.carFleet(10, position, speed);

}